import {
	AppPanelViewActionType,
	IAppPanelViewAbility,
	IAppPanelViewControllerParams,
	IAppPanelViewModel,
	IAppPanelViewStore,
	IParam,
	IViewEvent,
} from '@/core';
import { QXEvent } from 'qx-util';
import {
	getViewClassNames,
	useViewAction,
	useViewBasic,
	useViewControllerParams,
	useViewProps,
} from '../use-view';

/**
 * 获取应用面板视图（待办）输入参数
 *
 * @export
 * @return {*}
 */
export function useAppPanelViewProps() {
	return {
		...useViewProps(),
	};
}

/**
 * 获取应用面板视图（待办）基础
 *
 * @export
 * @param {IAppPanelViewModel} model 应用面板视图（待办）模型
 * @param {IParam} props 输入参数
 * @return {*}
 */
export function useAppPanelViewBasic(model: IAppPanelViewModel, props: IParam) {
	const getClassNames = (props: IParam) => {
		return getViewClassNames(model, props);
	};
	return {
		...useViewBasic(model, props),
		getClassNames,
	};
}

/**
 * 应用面板视图（待办）行为
 *
 * @export
 */
export function useAppPanelViewAction(controller: any) {
	return {
		...useViewAction(controller),
	};
}

/**
 * 获取应用面板视图（待办）控制器输入参数
 *
 * @export
 * @param {IAppPanelViewModel} model
 * @param {IParam} props
 * @param {QXEvent<IViewEvent<AppPanelViewActionType, IAppPanelViewAbility>>} evt
 * @return {*}  {IAppPanelViewControllerParams<AppPanelViewActionType, IAppPanelViewAbility>}
 */
export function useAppPanelViewControllerParams(
	model: IAppPanelViewModel,
	props: IParam,
	evt: QXEvent<IViewEvent<AppPanelViewActionType, IAppPanelViewAbility>>
): IAppPanelViewControllerParams<AppPanelViewActionType, IAppPanelViewAbility> {
	return {
		...useViewControllerParams<IAppPanelViewStore, IAppPanelViewModel>(
			model,
			props,
			evt
		),
	};
}
